//
//  QQButtonView.m
//  maoWeiVideo
//
//  Created by Stn on 2019/8/17.
//  Copyright © 2019 Stn. All rights reserved.
//

#import "QQButtonView.h"

@implementation QQButtonView
-(instancetype)initWithFrame:(CGRect)frame{
    self=[super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}
-(void)createBtnTitle:(NSString *)title AndImg:(UIImage *)Img AndFont:(UIFont *)font AndTextcolor:(UIColor *)color AndTextAlgment:(NSTextAlignment)textAlgnment{
    
    self.titLab=[UILabel CreatLabeltext:title Font:font Textcolor:color textAlignment:textAlgnment];
    [self addSubview:self.titLab];
    self.titLab.userInteractionEnabled=YES;
    self.Img=[[UIImageView alloc]init];
    self.Img.image=Img;
    [self addSubview:self.Img];
    self.Img.userInteractionEnabled=YES;
    
    
}
-(void)layoutWithType:(layoutType)type WithIntervali:(NSInteger)intervali{
    if (type == layoutTop) {
        [self.titLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_offset(0);
        }];
        [self.Img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(self.titLab.mas_top).offset(intervali);
            make.left.right.top.mas_offset(0);
        }];
    }else if (type == layoutLeft){
        [self.titLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.top.bottom.mas_offset(0);
        }];
        [self.Img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.bottom.mas_offset(0);
            make.right.mas_equalTo(self.titLab.mas_left).offset(-intervali);
        }];
    }else if (type == layoutRight){
        [self.titLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.bottom.mas_offset(0);
        }];
        [self.Img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.top.bottom.mas_offset(0);
            make.left.mas_equalTo(self.titLab.mas_right).offset(intervali);
        }];
    }else if (type == layoutBottom){
        [self.titLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.mas_offset(0);
        }];
        [self.Img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.left.right.mas_offset(0);
            make.top.mas_equalTo(self.titLab.mas_bottom).offset(intervali);
        }];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
